<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <style>

    </style>
</head>

<body>
    <div id="root">
        <button @click="tiaozhuan">点击</button>
    </div>

    <script>
        const vm = new Vue({
            el: '#root',
            data: {


            },
            methods: {
                tiaozhuan() {
                    if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
                        window.location.href = "https://www.bilibili.com/"; //手机
                    }else{
                        window.location.href= "https://www.baidu.com/"; //pc
                    }
                }


            },
            mounted() {


            },

        })
    </script>
</body>

</html>